package com.activemq.consumer;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

/**
 * @Author: 胡成
 * @Version: 0.0.1V
 * @Date: 2018/10/24
 * @Description: 消息消费者
 **/
@Component
public class MessageConsumerService {
    @JmsListener(destination = "study.msg.queue")
    public void receiveMessage(String text) {
        System.out.println("queue1 -> " + text);
    }

    @JmsListener(destination = "study.msg.queue")
    public void receiveMessage2(String text) {
        System.out.println("queue2 -> " + text);
    }

//    @JmsListener(destination = "study.msg.topic", containerFactory = "topicListenerContainer")
//    public void receiveMessageTopic(String text) {
//        System.out.println("topic -> " + text);
//    }
//
    @JmsListener(destination = "study.msg.topic", containerFactory = "topicListenerContainer")
    public void receiveMessageTopic2(String text) {
        System.out.println("topic2 -> " + text);
    }

    @JmsListener(destination = "study.msg.topic2", containerFactory = "topicListenerFactory1",id = "id1")
    public void receiveMessageTopic3(String text) {
        System.out.println("topic3 -> " + text);
    }

}
